#pragma once
#include "atlwince.h"

class CMemberInfoDlg :
    public CStdDialogResizeImpl<CMemberInfoDlg>
{
public:
    CMemberInfoDlg();

    enum { IDD = IDD_MEMBER_INFO };

    BEGIN_DLGRESIZE_MAP(CMemberInfoDlg)
        DLGRESIZE_CONTROL(IDC_EDT_MEMBER_NAME, DLSZ_SIZE_X)
        DLGRESIZE_CONTROL(IDC_EDT_MEMBER_NUMBER, DLSZ_SIZE_X)
    END_DLGRESIZE_MAP()

    BEGIN_MSG_MAP(CMemberInfoDlg)
        MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
        MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
        COMMAND_ID_HANDLER(ID_MENU_CONTACTS, OnMenuContacts)
        COMMAND_ID_HANDLER(ID_MENU_CANCEL, OnMenuCancel)
        COMMAND_HANDLER(IDC_EDT_MEMBER_NAME, EN_CHANGE, OnEdtMemberNameChange)
        COMMAND_HANDLER(IDC_EDT_MEMBER_NUMBER, EN_CHANGE, OnEdtMemberNumberChange)
        COMMAND_ID_HANDLER(IDOK, OnOk)
        CHAIN_MSG_MAP(CStdDialogResizeImpl<CMemberInfoDlg>)
    END_MSG_MAP()

    inline CEOID GetContactId(void)
    { return m_ContactId; }

    inline CEPROPID GetPropertyId(void)
    { return m_PropertyId; }

    inline void SetContactId(CEOID ContactId)
    { m_ContactId = ContactId; }

    inline void SetPropertyId(CEPROPID PropertyId)
    { m_PropertyId = PropertyId; }

    inline CString GetName(void)
    { return m_Name; }

    inline CString GetNumber(void)
    { return m_Number; }

private:

    // Handler prototypes (uncomment arguments if needed):
    // LRESULT MessageHandler(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    // LRESULT CommandHandler(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
    // LRESULT NotifyHandler(int /*idCtrl*/, LPNMHDR /*pnmh*/, BOOL& /*bHandled*/)

    LRESULT OnInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
    LRESULT OnDestroy(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);

    LRESULT OnMenuContacts(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnMenuCancel(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnEdtMemberNameChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnEdtMemberNumberChange(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);
    LRESULT OnOk(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/);

    void UpdateUI(void);

    CEdit m_NameEdit;
    CEdit m_NumberEdit;
    CString m_Name;
    CString m_Number;
    CEOID m_ContactId;
    CEPROPID m_PropertyId;
};
